package com.frxuexi.roport

import com.frxuexi.lib_base.ApiResp
import com.frxuexi.lib_base.BaseViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

@HiltViewModel
class ReportViewModel @Inject constructor(private val reportPepo: ReportPepo):BaseViewModel<ReportIntent>() {
    override fun handleIntent(it: ReportIntent) {
        when(it){
            is ReportIntent.getReports->
                httpRequest(reportPepo.getReports(it.map) as Flow<ApiResp<Any>>)
            is ReportIntent.addReport->
                httpRequest(reportPepo.addReport(it.map))
        }
    }
}